package com.xbongbong.saas.enums;

import com.xbongbong.i18n.util.I18nMessageUtil;

import java.util.ArrayList;
import java.util.List;


/**
 * 操作模块枚举，用于日志记录
 * 来着 SAAS 项目
 * 1000XX 以后为 PAAS 项目模块
 * @author old version
 * @since old version
 */
public enum OperateModuleTypeEnum {
	/**
	 * 客户
	 */
	CUSTOMER(1,"enum.operateModuleType.name.customer","customer"),


	OPPORTUNITY(2,"enum.operateModuleType.name.opportunity","opportunity"),


	CONTRACT(3,"enum.operateModuleType.name.contract","contract"),


	CONTACT(4,"enum.operateModuleType.name.contact","contact"),


	PRODUCT(5,"enum.operateModuleType.name.product","product"),


	ROLE(6,"enum.operateModuleType.name.role","role"),


	STAFF(7,"enum.operateModuleType.name.staff","staff"),


	APPROVAL(8,"enum.operateModuleType.name.approval","approval"),


	CustomerCommunicate(9,"enum.operateModuleType.name.customercommunicate","CustomerCommunicate"),


	CommunicatePlan(10,"enum.operateModuleType.name.communicateplan","CommunicatePlan"),


	RedunantTemplate(11,"enum.operateModuleType.name.redunanttemplate","RedunantTemplate"),


	PaymentManage(12,"enum.operateModuleType.name.paymentmanage","PaymentManage"),


	OpenSeaRules(13,"enum.operateModuleType.name.opensearules","OpenSeaRules"),


	PerformanceObject(14,"enum.operateModuleType.name.performanceobject","PerformanceObject"),


	CABINET(15,"enum.operateModuleType.name.cabinet","Cabinet"),


	STRATEGY(16,"enum.operateModuleType.name.strategy","Strategy"),


	INSTOCK(17,"enum.operateModuleType.name.instock","instock"),


	OUTSTOCK(18,"enum.operateModuleType.name.outstock","outstock"),


	PURCHASE(19,"enum.operateModuleType.name.purchase","purchase"),


	RETURN_PURCHASE(20,"enum.operateModuleType.name.return_purchase","returnedPurchase"),


	TRANSFER(21,"enum.operateModuleType.name.transfer","transfer"),


	INVENTORY(22,"enum.operateModuleType.name.inventory","inventory"),


	PK(23,"enum.operateModuleType.name.pk","pk"),


	INVOICE(24,"enum.operateModuleType.name.invoice","invoice"),


	WORKREPORT(25,"enum.operateModuleType.name.workreport","workReport"),


	PUBLIC_GROUP(26,"enum.operateModuleType.name.public_group","publicGroup"),


	MODULE(27,"enum.operateModuleType.name.module","module"),


	SIGNIN(28,"enum.operateModuleType.name.signin","signIn"),


	REPORT_TARGETSET(29,"enum.operateModuleType.name.report_targetset","module"),


	NUMBERRULE(30,"enum.operateModuleType.name.numberrule","numberRule"),


	REFUND(31,"enum.operateModuleType.name.refund","refund"),


	ORGANIZATIONAL_STRUCTURE(32,"enum.operateModuleType.name.organizational_structure","organizationalStructure"),


	PayManage(33,"enum.operateModuleType.name.paymanage","payPlan"),


	ASSEMBLE(34,"enum.operateModuleType.name.assemble","assemble"),


	SUPPLIER(35,"enum.operateModuleType.name.supplier","supplier"),


	WAREHOUSE(36,"enum.operateModuleType.name.warehouse","warehouse"),


	BOMBILL(37,"enum.operateModuleType.name.bombill","bomBill"),


	PRODUCTION_ORDER(38,"enum.operateModuleType.name.production_order","productionOrder"),


	COMPANY_CONFIG(39,"enum.operateModuleType.name.company_config","companyConfig"),


	SUPPLIER_CONTACT(40,"enum.operateModuleType.name.supplier_contact","supplierContact"),


	SUPPLIER_COMMUNICATE(41,"enum.operateModuleType.name.supplier_communicate","supplierCommunicate"),

	LOGIN_SYSTEM(130,"enum.operateModuleType.name.login_system","loginSystem"),

	/**
	 * 下面还有四个关于工单的，分别为：工单，工单模板字段、工单表单字段描述
	 */
	WORK(42,"enum.operateModuleType.name.work","work"),


	WORK_ORDER(43,"enum.operateModuleType.name.work_order","workOrder"),

    HOME_BOARD_SET(44, "enum.operateModuleType.name.home_board_set", "homeBoardSet"),

	RESPONSIBLE_TEAM(45, "enum.operateModuleType.name.responsible_team", "responsibleTeam"),

	COLLABORATIVE_TEAM(46, "enum.operateModuleType.name.collaborative_team", "collaborativeTeam"),

	/**
	 * 预收款余额
	 */
	PREPAYMENT_BALANCE(47,XbbRefTypeEnum.PREPAYMENT_BALANCE.getI18nName(),XbbRefTypeEnum.PREPAYMENT_BALANCE.getAlias()),
	/**
	 * 回款单
	 */
	PAYMENT_SHEET(48, XbbRefTypeEnum.PAYMENT_SHEET.getI18nName(), XbbRefTypeEnum.PAYMENT_SHEET.getAlias()),
	/**
	 * 预付款余额
	 */
	PREPAY_BALANCE(57,XbbRefTypeEnum.PREPAY_BALANCE.getI18nName(),XbbRefTypeEnum.PREPAY_BALANCE.getAlias()),
	/**
	 * 付款单
	 */
	PAY_SHEET(58, XbbRefTypeEnum.PAY_SHEET.getI18nName(), XbbRefTypeEnum.PAY_SHEET.getAlias()),

    PRODUCTION_INSTOCK(49, "enum.operateModuleType.name.production_instock", "productionInstock"),
	RETURNED_MATERIEL_INSTOCK(50, "enum.operateModuleType.name.returned_materiel_instock", "returnedMaterielInstock"),

	CONTRACT_OUTSTOCK(51, "enum.operateModuleType.name.contract_outstock", "contractOutstock"),
	RETURNED_PURCHASE_OUTSTOCK(52, "enum.operateModuleType.name.returned_purchase_outstock", "returnedPurchaseOutstock"),
	PRODUCTION_MATERIEL_OUTSTOCK(53, "enum.operateModuleType.name.production_materiel_outstock", "productionMaterielOutstock"),
	WORK_ORDER_OUTSTOCK(54, "enum.operateModuleType.name.work_order_outstock", "workOrderOutstock"),
	PURCHASE_INSTOCK(55,"enum.operateModuleType.name.purchase_instock","purchaseInstock"),
	REFUND_INSTOCK(56,"enum.operateModuleType.name.refund_instock","refundInstock"),
	// 库存流水
	STOCK_FLOW_BILL(59, "enum.operateModuleType.name.stock_flow_bill", "stockFlowBill"),
	// 库存台账
	STOCK_STANDING_BOOK(60, "enum.operateModuleType.name.stock_standing_book", "stockStandingBook"),
	// 序列号查询
	SEQ_SEARCH(61,"enum.operateModuleType.name.seq_search","productSerialBalance"),
	// 批次流水
	BATCH_FLOW_BILL(62, "enum.operateModuleType.name.batch_flow_bill", "batchFlowBill"),
	SETTLE_ACCOUNTS(63, "enum.operateModuleType.name.settle_accounts", "settleAccounts"),
	ANTI_SETTLEMENT(64, "enum.operateModuleType.name.anti_settlement", "antiSettlement"),

	/**
	 * 市场活动
	 */
	MARKET_ACTIVITY(70,"enum.operateModuleType.name.market_activity","marketActivity"),

	/**
	 * 线索
	 */
	CLUE(80,"enum.operateModuleType.name.clue","clue"),
	//价目表
	PRICE_SET(81, "enum.operateModuleType.name.price_set", "priceSet"),
	//营销活动管理
	MARKETING_ACTIVITY_MANAGEMENT(82, "enum.operateModuleType.name.marketing_activity_management", "marketingActivityManagement"),
	//促销活动管理
	PROMOTION_ACTIVITY_MANAGEMENT(83, "enum.operateModuleType.name.promotion_activity_management", "promotionActivityManagement"),

	/**
	 * 信用管理
	 */
	CREDIT_LIMIT(90, "enum.operateModuleType.name.credit_limit", "creditLimit"),
	CREDIT_TEMPORARY_LIMIT(91, "enum.operateModuleType.name.credit_temporary_limit", "creditTemporaryLimit"),
	CREDIT_FIXED_LIMIT(92, "enum.operateModuleType.name.credit_fixed_limit", "creditFixedLimit"),
	CREDIT_CARD_BILL(93, "enum.operateModuleType.name.credit_card_bill", "creditCardBill"),

	/**
	 * 竞争对手
	 */
	COMPETITOR(100,"enum.operateModuleType.name.competitor","competitor"),

	/**
	 * 竞争对手分析
	 */
	COMPETITOR_ANALYSIS(101,"enum.operateModuleType.name.competitor_analysis","competitorAnalysis"),

	/**
	 * 客户公海池
	 */
	CUSTOMER_PUBLIC(102,"enum.operateModuleType.name.customer_public","customerPublic"),
	/**
	 * 线索公海池
	 */
	CLUE_PUBLIC(103,"enum.operateModuleType.name.clue_public","cluePublic"),
	/**
	 * 规则名称
	 */
	PUBLIC_RULE_NAME(104,"enum.operateModuleType.name.public_rule_name","publicRuleName"),
	/**
	 * 适用范围
	 */
	APPLY_SCOPE(105,"enum.operateModuleType.name.apply_scope","applyScope"),
	/**
	 * 筛选条件
	 */
	FILTER_SCREEN(106,"enum.operateModuleType.name.filter_screen","filterScreen"),
	/**
	 *触发条件
	 */
	TRIGGER_SCREEN(107,"enum.operateModuleType.name.trigger_screen","triggerScreen"),
	/**
	 * 目标公海
	 */
	OBJECT_GROUP(108,"enum.operateModuleType.name.object_group","objectGroup"),
	/**
	 * 分组名称
	 */
	PUBLIC_GROUP_NAME(109,"enum.operateModuleType.name.public_group_name","pubicGroupName"),
	/**
	 * 分组管理员
	 */
	ADMIN_SCOPE(110,"enum.operateModuleType.name.admin_scope","adminScope"),
	/**
	 * 分组成员
	 */
	USER_SCOPE(111,"enum.operateModuleType.name.user_scope","userScope"),
	/**
	 * 初始化规则
	 */
	INTI_RULE(112,"enum.operateModuleType.name.init_rule","initRule"),

	/**
	 * 工单模板
	 */
	PAAS_FORM_WORK_ORDER(1013,"enum.operateModuleType.name.paas_form_work_order","paasFormWorkOrder"),

	/**
	 * 工单表单字段描述
	 */
	PAAS_FORM_EXPLAIN_WORK_ORDER(1014,"enum.operateModuleType.name.paas_form_explain_work_order","paasFormExplainWorkOrder"),

	QUOTATION(1015,"enum.operateModuleType.name.quotation","quotation"),

	ORI_STOCK(1016,"enum.operateModuleType.name.ori_stock","oriStock"),

	PURCHASE_INVOICE(1017,"enum.operateModuleType.name.purchase_invoice","purchaseInvoice"),

	UNKNOWN(404,"enum.operateModuleType.name.unknown","unknown"),

	/************************************以下为PAAS项目模块*****************************************************/

	/**
	 * 应用
	 */
	PAAS_APP(1001,"enum.operateModuleType.name.paas_app","paasApp"),

	/**
	 * 菜单
	 */
	PAAS_MENU(1002,"enum.operateModuleType.name.paas_menu","paasMenu"),

	/**
	 * 表单
	 */
	PAAS_FORM(1003,"enum.operateModuleType.name.paas_form","paasForm"),

	/**
	 * 表单描述
	 */
	PAAS_FORM_EXPLAIN(1004,"enum.operateModuleType.name.paas_form_explain","paasFormExplain"),

	/**
	 * 表单数据
	 */
	PAAS_FORM_DATA(1012,"enum.operateModuleType.name.paas_form_data","paasFormData"),

	/**
	 * 流程模板
	 */
	PAAS_PROCESS_TEMPLATE(1005,"enum.operateModuleType.name.paas_process_template","processTemplate"),

	/**
	 * 流程节点
	 */
	PAAS_PROCESS_TEMPLATE_NODE(1006,"enum.operateModuleType.name.paas_process_template_node","paasProcessTemplateNode"),

	/**
	 * 流程条件
	 */
	PAAS_PROCESS_CONDITION(1007,"enum.operateModuleType.name.paas_process_condition","paasProcessCondition"),


	PAAS_PROCESS_TASK(1008,"enum.operateModuleType.name.paas_process_task","paasProcessTask"),


	PAAS_CONFIG(1009,"enum.operateModuleType.name.paas_config","paasConfig"),


	PAAS_STATISTICS(1010,"enum.operateModuleType.name.paas_statistics","paaSStatistics"),


	PAAS_PRINT(1011,"enum.operateModuleType.name.paas_print","paaSPrint"),

	/**
	 * 富文本
	 */
	PAAS_RICH_TEXT(1018, "enum.operateModuleType.name.paas_rich_text", "paasRichText"),

	/**
	 * 智能助手
	 */
	AI_ASSISTANT(1020,"enum.operateModuleType.name.ai_assistant","aiAssistant"),

	SERVICE_REGISTRATION(1021,"enum.operateModuleType.name.service_registration","serviceRegistration"),

	DEVELOPER(1022,"enum.operateModuleType.name.developer","developer"),

	/**
	 *  数据中心
	 */
	DATA_CENTER(1030,"enum.operateModuleType.name.data_center","dataCenter"),

	/**
	 * pro 图表
	 */
	CHART(2001,"enum.operateModuleType.name.chart","chart"),


	CHART_CATEGORY(2002,"enum.operateModuleType.name.chart_category","chartCategory"),

	/**
	 * 消息推送设置
	 */
	MESASAGE_PUSH_SET(3001,"enum.operateModuleType.name.mesasage_push_set","messagePushSet"),


	PUSH_NOTIFY(4100,"enum.operateModuleType.name.push_notify","pushNotify"),

	/**
	 * 资金设置
	 */
	FUND_SET(4300, "enum.operateModuleType.name.fund_set", "fundSet"),

	/**
	 * 销项发票可编辑需求的弹出界面名称    发票关联合同订单
	 */
	INVOICE_LINK_CONTRACT(4301,"enum.operateModuleType.name.invoice_link_contract", "invoiceLinkContract"),
	/**
	 * 线索联合查重
	 */
	DUPLICATE_ALL_TEMPLATE(4302,"enum.operateModuleType.name.all_template", "allTemplate"),

	/**
	 * 查重的结果展示
	 */
	DUPLICATE_RESULT_SHOW(4303,"enum.operateModuleType.name.duplicate_result_show", "duplicateResultShow"),


	/**
	 * 查重的线索联合查重,联合客户
	 */
	DUPLICATE_CLUE_JOINT_CUSTOMER(4304,"enum.operateModuleType.name.duplicate_clue_joint_customer", "duplicateClueJointCustomer"),
	/**
	 * 联合联系人
	 */
	DUPLICATE_CLUE_JOINT_CONTACT(4305,"enum.operateModuleType.name.duplicate_clue_joint_contact", "duplicateClueJointContact"),

	/**
	 * 对账单
	 */
	CUSTOMER_STATEMENT(5401,XbbRefTypeEnum.CUSTOMER_STATEMENT.getI18nName(),XbbRefTypeEnum.CUSTOMER_STATEMENT.getAlias()),
	CUSTOMER_STATEMENT_STATISTIC(5403,XbbRefTypeEnum.CUSTOMER_STATEMENT_STATISTIC.getI18nName(),XbbRefTypeEnum.CUSTOMER_STATEMENT_STATISTIC.getAlias()),

	/**
	 * 经销商
	 */
	DISTRIBUTOR(7001, "enum.operateModuleType.name.distributor", "distributor"),
	DISTRIBUTOR_COMMUNICATE(7002, "enum.operateModuleType.name.distributor_communicate", "distributorCommunicate"),
	DISTRIBUTOR_CONTACT(7003, "enum.operateModuleType.name.distributor_contact", "distributorContact"),
	DISTRIBUTOR_ACCOUNT(7004, "enum.xbbRefType.name.distributor_account", "distributorAccount"),

	/**
	 * 出库发货单
	 */
	ORDER_OUTSTOCK(7005, "enum.operateModuleType.name.order_outstock", "orderOutstock"),

	/**
	 * 退货单
	 */
	RETURN(7006, "enum.operateModuleType.name.return", "return"),

	/**
	 * 订货单
	 */
	ORDER(7007, "enum.operateModuleType.name.order", "order"),

	/**
	 * 标签设置
	 */
	LABEL_GROUP_SET(5001,"enum.operateModuleType.name.label_group_set","labelGroupSet"),
	LABEL_SET(5002,"enum.operateModuleType.name.label_set","labelSet"),

	/**
	 * 评分规则设置
	 */
	SCORE_RULE_SET(6001,"enum.operateModuleType.name.score_rule_set","scoreRuleSet"),
	/**
	 * 数据集
	 */
	DATA_SET(6300,"enum.operateModuleType.name.data_set","dataSet"),

	/**
	 * 数据预警
	 */
	DATA_WARNING(8001,"enum.operateModuleType.name.data_warning_set","dataWarningSet"),

	/**
	 * 其他收支单
	 */
	OTHER_FUND_MANAGEMENT(5700,"enum.operateModuleType.name.other_fund_management","otherFundManagement"),

	/**
	 * 资金调拨单
	 */
	FUND_TRANSFER(5800, "enum.operateModuleType.name.fund_transfer", "fundTransfer"),
    /**
     * 流水号获取
     */
    SERIAL_NO(5900, "enum.operateModuleType.name.serial_no_get","serialNoGet"),
	WORKFLOW(7000, "enum.operateModuleType.name.workflow","workflow"),

	WORKFLOW_TRIGGER_NODE(9001, "enum.operateModuleType.name.workflow_trigger_node","workflowTriggerNode"),
	WORKFLOW_NODE(9002, "enum.operateModuleType.name.workflow_node","workflowNode"),
	CONNECTOR(10000, "enum.operateModuleType.name.connector","connector"),

	COST_ADJUST(9010, "enum.operateModuleType.name.cost_adjust","costAdjust"),

	/**
	 * 精线索联系方式解锁
	 */
	SOUKE(9003,"enum.operateModuleType.name.souKe","souKe"),
	/**
	 * 首页管理
	 */
	HOME_PAGE_MANAGE(10001,"enum.operateModuleType.name.home_page_manage","homePageManage"),

	/**
	 * 阶段推进器-阶段设置
	 */
	STAGE(7500,"enum.operateModuleType.name.stage_set","stageSet"),
	/**
	 * 阶段推进器-阶段任务设置
	 */
	STAGE_WORK(7501,"enum.operateModuleType.name.stage_work_set","stageSet"),
	/**
	 * 阶段推进器-阶段流程设置
	 */
	STAGE_PROCESS(7502,"enum.operateModuleType.name.stage_process_set","stageSet"),


	/**
	 *  表单标签
	 */
	FORM_LABEL(9700,"enum.operateModuleType.name.form_label","formLabel"),

	/**
	 *  系统标签
	 */
	SYSTEM_LABEL(9800,"enum.operateModuleType.name.system_label","systemLabel"),

	/**
	 *  低代码
	 */
	LOW_CODE(100001, "enum.operateModuleType.name.low_code", "lowCode"),

	/**
	 *  知识库
	 */
	KNOWLEDGE_BASE(20100,"enum.operateModuleType.name.knowledgeBase","knowledgeBase"),

	// 知识库标签库
	KNOWLEDGE_BASE_TAG(20200,"enum.operateModuleType.name.knowledge_base_tag","knowledgeBaseTag"),

	CONTRACTCOMPARE(20300,"enum.operateModuleType.name.contractCompare","contractCompare"),

	/**
	 * 登录日志
	 */
	LOGIN_LOG(20301,"enum.operateModuleType.name.login_log","loginLog"),
	/**
	 * 操作日志
	 */
	OPERATE_LOG(20302,"enum.operateModuleType.name.operate_log","operateLog"),

	/**
	 * 服务项目
	 */
	SERVICE_PROJECT(20400,"enum.operateModuleType.name.service_project","serviceProject"),

	WORK_ORDER_V2(20500,"enum.operateModuleType.name.work_order_v2","workOrderV2"),
	SLA_LOG(20501,"enum.xbbRefType.name.sla_log","slaLog"),
	/**
	 * 回执单
	 */
	RECEIPT_ORDER(20600, "enum.operateModuleType.name.receipt_order","receiptOrder"),

    // 工单池
    WORK_ORDER_V2_POOL(20700, "enum.operateModuleType.name.work_order_v2_pool","workOrderV2Pool"),

    // 工单目录
    WORK_ORDER_V2_CATALOGUE(20800,"enum.operateModuleType.name.work_order_v2_catalogue","workOrderV2Catalogue"),

	SHARE_RULE_PERMISSION(20900, "enum.operateModuleType.name.share_rule_permission", "shareRulePermission"),

	;

	/** 枚举值 -- 模块类型标识*/
	private final int code;

	/** 枚举信息--模块名称*/
	private final String name;

	/** 枚举描述 --*/
	private final String alias;

	/**
	 * 构造一个<code>SubModuleEnum</code>枚举对象
	 *
	 * @param code
	 * @param name
	 * @param alias
	 */
	OperateModuleTypeEnum(int code, String name, String alias) {
		this.code = code;
		this.name = name;
		this.alias = alias;
	}

	/**
	 * @return Returns the code.
	 */
	public int getCode() {
		return code;
	}

	/**
	 * @return Returns the name.
	 */
	public String getName() {
		return I18nMessageUtil.getMessage(name);
	}

	/**
	 * @return Returns the alias.
	 */
	public String getAlias() {
		return alias;
	}

	/**
	 * 通过枚举<code>alias</code>获得枚举
	 *
	 * @param alias
	 * @return OperateModuleTypeEnum
	 */
	public static OperateModuleTypeEnum getByAlias(String alias) {
		for (OperateModuleTypeEnum cacheCode : values()) {
			if (cacheCode.getAlias().equals(alias)) {
				return cacheCode;
			}
		}
		return UNKNOWN;
	}

	/**
	 * 通过枚举<code>code</code>获得枚举
	 *
	 * @param code
	 * @return OperateModuleTypeEnum
	 */
	public static OperateModuleTypeEnum getByCode(Integer code) {
		for (OperateModuleTypeEnum cacheCode : values()) {
			if (code.equals(cacheCode.getCode())) {
				return cacheCode;
			}
		}
		return UNKNOWN;
	}

	/**
	 * 获取全部枚举
	 *
	 * @return List<OperateModuleTypeEnum>
	 */
	public static List<OperateModuleTypeEnum> getAllEnum() {
		List<OperateModuleTypeEnum> list = new ArrayList<>();
		for (OperateModuleTypeEnum cache : values()) {
			if (cache == UNKNOWN) {
				continue;
			}
			list.add(cache);
		}
		return list;
	}

	/**
	 * 获取全部枚举值
	 *
	 * @return List<String>
	 */
	public List<String> getAllEnumAlis() {
		List<String> list = new ArrayList<>();
		for (OperateModuleTypeEnum cache : values()) {
			if (cache == UNKNOWN) {
				continue;
			}
			list.add(cache.getAlias());
		}
		return list;
	}
}
